<template>
  <div>
    <el-table
        :data="tableList"
        border
        style="width: 100%">
      <el-table-column label="id" width="180">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span style="margin-left: 10px">{{ scope.row.id }}</span>
        </template>
      </el-table-column>
      <el-table-column label="名字" prop="name" width="180"></el-table-column>
      <el-table-column label="别名" prop="alias" width="180"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      tableList: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }],
      token:'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwidXNlcm5hbWUiOiJhZG1pbjEyMyIsInBhc3N3b3JkIjoiIiwibmlja25hbWUiOiLlsI_lvIDlp4vlvIDlp4siLCJlbWFpbCI6IjE1NUBxcS5jb20iLCJ1c2VyX3BpYyI6IiIsImlhdCI6MTY4ODcwMDYwNCwiZXhwIjoxNjg4NzM2NjA0fQ.TRAGKuVKdAtfuBJsJR7vHdlxmpZgwdQ7jCSY-MY1MGc',
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      axios.get('http://127.0.0.1:3007/my/article/cates',{
        headers: {'Authorization': this.token}
      }).then(res=>{
        console.log(res)
        this.tableList = res.data.data
      }).catch(err=>{
          this.$message.error(err.message)
      })
    }
  }
}
</script>

<style scoped>

</style>
